package com.example.permissionservice.servletComponent;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 *  自定义Filter类
 */
@WebFilter
public class MyFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
                         FilterChain filterChain) throws IOException, ServletException {
        String address = servletRequest.getServletContext().getContextPath();
        int port = servletRequest.getLocalPort();
        System.out.println("[permission-service-provider-2]已接收该请求，本服务端端口为："+port);
        filterChain.doFilter(servletRequest,servletResponse);
    }

    @Override
    public void destroy() {

    }
}
